#ifndef __S_XPT2046_H__
#define __S_XPT2046_H__

typedef struct
{
    void (*cs_enable)(void);
    void (*cs_disable)(void);
    signed char (*write)(unsigned char *cmd, unsigned short len);
    signed char (*read)(unsigned char *cmd, unsigned short len);
    void (*delay_us)(unsigned int time);
    unsigned short raw_x;
    unsigned short raw_y;
    unsigned short raw_z;
}s_xpt2046_t;

typedef enum
{
    s_xpt2046_ok = 0,
    s_xpt2046_cs_enable_null,
    s_xpt2046_cs_disable_null,
    s_xpt2046_write_null,
    s_xpt2046_read_null,
    s_xpt2046_delay_null,
    s_xpt2046_xoutof_range,
    s_xpt2046_youtof_range,
    s_xpt2046_max_error,
    s_xpt2046_z_error,
}s_xpt2046_state;

extern s_xpt2046_state s_xpt2046_read_raw_pos(s_xpt2046_t *xpt);

#endif
